(0, require("../common/component").VantComponent)({
    field: !0,
    classes: [ "input-class", "right-icon-class" ],
    props: {
        size: String,
        icon: String,
        label: String,
        error: Boolean,
        fixed: Boolean,
        focus: Boolean,
        center: Boolean,
        isLink: Boolean,
        leftIcon: String,
        rightIcon: String,
        disabled: Boolean,
        autosize: Boolean,
        readonly: Boolean,
        required: Boolean,
        password: Boolean,
        iconClass: String,
        clearable: Boolean,
        inputAlign: String,
        customClass: String,
        customStyle: String,
        confirmType: String,
        confirmHold: Boolean,
        errorMessage: String,
        placeholder: String,
        placeholderStyle: String,
        errorMessageAlign: String,
        showConfirmBar: {
            type: Boolean,
            value: !0
        },
        adjustPosition: {
            type: Boolean,
            value: !0
        },
        cursorSpacing: {
            type: Number,
            value: 50
        },
        maxlength: {
            type: Number,
            value: -1
        },
        type: {
            type: String,
            value: "text"
        },
        border: {
            type: Boolean,
            value: !0
        },
        titleWidth: {
            type: String,
            value: "90px"
        }
    },
    data: {
        showClear: !1
    },
    beforeCreate: function() {
        this.focused = !1;
    },
    methods: {
        onInput: function(e) {
            var self = this, detail = (e.detail || {}), value = void 0 === detail.value ? "" : detail.value;
            self.set({
                value: value,
                showClear: self.getShowClear(value)
            }, function() {
                self.emitChange(value);
            });
        },
        onFocus: function(e) {
            var self = this, detail = e.detail || {}, value = void 0 === detail.value ? "" : detail.value, height = void 0 === detail.height ? 0 : detail.height;
            self.$emit("focus", {
                value: value,
                height: height
            }), self.focused = !0, self.blurFromClear = !1, self.set({
                showClear: self.getShowClear()
            });
        },
        onBlur: function(e) {
            var self = this, detail = e.detail || {}, value = void 0 === detail.value ? "" : detail.value, cursor = void 0 === detail.cursor ? 0 : detail.cursor;
            self.$emit("blur", {
                value: value,
                cursor: cursor
            }), self.focused = !1;
            var showClearFlag = self.getShowClear();
            self.data.value === value ? self.set({
                showClear: showClearFlag
            }) : self.blurFromClear || self.set({
                value: value,
                showClear: showClearFlag
            }, function() {
                self.emitChange(value);
            });
        },
        onClickIcon: function() {
            this.$emit("click-icon");
        },
        getShowClear: function(e) {
            return e = void 0 === e ? this.data.value : e, this.data.clearable && this.focused && e && !this.data.readonly;
        },
        onClear: function() {
            var self = this;
            self.blurFromClear = !0, self.set({
                value: "",
                showClear: self.getShowClear("")
            }, function() {
                self.emitChange(""), self.$emit("clear", "");
            });
        },
        onConfirm: function() {
            this.$emit("confirm", this.data.value);
        },
        emitChange: function(e) {
            this.$emit("input", e), this.$emit("change", e);
        }
    }
});